function [m,n] = PdrCiAnalysis(fileName, pdrRequirement)
m =0;
n=0;
N = 111; % # of .txt files
ALPHA = 0.05;
%UPPER_BOUND = [];
%LOWER_BOUND = [];
% window sizes for every link
f_id = fopen (fileName);
%data = importdata (['link_txrx_status.txt']);
link_index = 1;
while feof (f_id) == 0
    line = fgetl (f_id);
    line = fgetl (f_id);
    rx = str2num (line);
    s = rx;
    s(find(s > 0)) = 1;
    %%==============================Fixed window size ===================================
    window_size = 200;
    last_bit = length (s) - window_size;
    start_bit = 5000;
    pdr = zeros (1, last_bit - start_bit + 1);
    for i = start_bit: 1 : last_bit
       pdr(i - start_bit + 1) = sum (s (i:i+window_size))/ window_size;
    end
     %====================================================================================

     %%==============================Random Sampling =====================================
     %{
     w = [];
     window_size = 1000; %Max Window Size
     last_bit = length (s) - window_size;
     step_size = 10;
     start_bit = 5000;
     number_of_samples = 400;
     pdr = zeros (1, number_of_samples);
     for i=1:1:number_of_samples
       bit_position = round (random('Uniform',start_bit, last_bit));
       [start_index, end_index] = CalculateStationaryWindowSize (bit_position, window_size, step_size, s);
       pdr(i) = sum (s (start_index:end_index))/ (end_index - start_index + 1);
       w = [w; end_index - start_index + 1];
    end

    %}


    %====================================================================================
    dev =  norminv(1 - ALPHA / 2, 0, 1) * std(pdr) / sqrt(size(pdr, 1));
    if mean(pdr) + dev >= pdrRequirement
      m = m + 1;
    elseif mean(pdr) - dev >= pdrRequirement
      m + 1;
    else
      n = n + 1;
    end
    %UPPER_BOUND = [UPPER_BOUND; mean(pdr) + dev ];
    %LOWER_BOUND = [LOWER_BOUND; mean(pdr) - dev ];
    link_index = link_index + 1;
end
fclose (f_id);

%cdfplot(LOWER_BOUND);
%hold on;
%cdfplot(UPPER_BOUND);
%hold off;
